package com.smart.village.big.screen.controller.bigscreen;

import com.github.pagehelper.PageHelper;
import com.smart.village.big.screen.domain.AjaxResult;
import com.smart.village.big.screen.service.AdminChartsService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 管理端-商城模块-销售数据分析图表接口
 */
@Tag(name = "管理端-商城模块-销售数据分析图表接口")
@RestController
@RequestMapping("/admin/charts")
public class AdminChartsController {


    @Autowired
    private AdminChartsService adminChartsService;

    // top3大指标
    // 销售数据分析- top3大指标
    @Operation(summary = "销售数据分析- top3大指标")
    @GetMapping("/top3")
    @ResponseBody
    public AjaxResult top3() {
        return AjaxResult.success(adminChartsService.top3());
    }


    // 市场动态
    // 销售数据分析- 市场动态
    @Operation(summary = "销售数据分析- 市场动态")
    @GetMapping("/marketDynamic")
    @ResponseBody
    public AjaxResult marketDynamic(@RequestParam(required = false, defaultValue = "month") String type) {
        return AjaxResult.success(adminChartsService.marketDynamic(type));
    }

    //预定趋势
    // 销售数据分析- 预定趋势
    @Operation(summary = "销售数据分析- 预定趋势")
    @GetMapping("/bookingTrend")
    @ResponseBody
    public AjaxResult bookingTrend(@RequestParam(required = false, defaultValue = "month") String type) {
        return AjaxResult.success(adminChartsService.bookingTrend(type));
    }

    // 销售数据分析
    // 销售数据分析- 房型偏好
    @Operation(summary = "销售数据分析- 房型偏好")
    @GetMapping("/roomTypePreference")
    @ResponseBody
    public AjaxResult roomTypePreference() {
        return AjaxResult.success(adminChartsService.roomTypePreference());
    }


    //入住时常分布
    // 销售数据分析- 入住时常分布
    @Operation(summary = "销售数据分析- 入住时常分布")
    @GetMapping("/checkInDurationDistribution")
    @ResponseBody
    public AjaxResult checkInDurationDistribution() {
        return AjaxResult.success(adminChartsService.checkInDurationDistribution());
    }

    //热门入住日期
    // 销售数据分析- 热门入住日期
    @Operation(summary = "销售数据分析- 热门入住日期")
    @GetMapping("/popularCheckInDate")
    @ResponseBody
    public AjaxResult popularCheckInDate() {
        return AjaxResult.success(adminChartsService.popularCheckInDate());
    }



    //评分趋势分析
    @Operation(summary = "评分趋势分析")
    @GetMapping("/staticBusinessScore")
    @Parameters({
            @Parameter(name = "type", description = "时间类型day week month ")
    })
    @ResponseBody
    public AjaxResult staticBusinessScore(@RequestParam(required = false, defaultValue = "month") String type) {
        return AjaxResult.success(adminChartsService.staticBusinessScore(type));
    }

    // 评分趋势列表
    @Operation(summary = "评分趋势列表")
    @GetMapping("/staticBusinessScoreList")
    @Parameters({
            @Parameter(name = "type", description = "时间类型 day week month "),
            @Parameter(name = "search", description = "搜索")
    })
    @ResponseBody
    public AjaxResult staticBusinessScoreList(
            @RequestParam(required = false, defaultValue = "") String type,
            @RequestParam(required = false, defaultValue = "") String search,
            @RequestParam(required = false, defaultValue = "1") Integer pageNum,
            @RequestParam(required = false, defaultValue = "10") Integer pageSize
    ) {
        return AjaxResult.success(adminChartsService.staticBusinessScoreList(type, search, pageNum, pageSize));
    }

    // 评分趋势详情
    @Operation(summary = "评分趋势详情")
    @GetMapping("/staticBusinessScoreDetail")
    @Parameters({
            @Parameter(name = "staticBusinessScoreSerialNumber", description = "评分趋势详情编号")
    })
    @ResponseBody
    public AjaxResult staticBusinessScoreDetail(
            @RequestParam String staticBusinessScoreSerialNumber

    ) {
        return AjaxResult.success(adminChartsService.staticBusinessScoreDetail(staticBusinessScoreSerialNumber));
    }

    //留言数据分析报告
    // 留言数据分析报告
    @Operation(summary = "留言数据分析报告")
    @GetMapping("/messageAnalysisReport")
    @ResponseBody
    public AjaxResult messageAnalysisReport() {
        return AjaxResult.success(adminChartsService.messageAnalysisReport());
    }

    //留言趋势分析
    @Operation(summary = "留言趋势分析 data1 留言 data2 回复")
    @GetMapping("/messageTrend")
    @Parameters({
            @Parameter(name = "type", description = "时间类型day week month quarter")
    })
    @ResponseBody
    public AjaxResult messageTrend(@RequestParam(required = false, defaultValue = "week") String type) {
        return AjaxResult.success(adminChartsService.messageTrend(type));
    }

    //热门话题分析
    // 热门话题分析
    @Operation(summary = "热门话题分析")
    @GetMapping("/hotTopic")
    @ResponseBody
    public AjaxResult hotTopic() {
        return AjaxResult.success(adminChartsService.hotTopic());
    }


    //满意度分析
    // 满意度分析
    @Operation(summary = "满意度分析")
    @GetMapping("/satisfactionAnalysis")
    @ResponseBody
    public AjaxResult satisfactionAnalysis() {
        return AjaxResult.success(adminChartsService.satisfactionAnalysis());
    }


    //票务系统可视化报表指标
    // 票务系统可视化报表指标
    @Operation(summary = "票务系统可视化报表指标")
    @GetMapping("/ticketSystemVisualizationMetrics")
    @ResponseBody
    public AjaxResult ticketSystemVisualizationMetrics() {
        return AjaxResult.success(adminChartsService.ticketSystemVisualizationMetrics());
    }


    //景点实时客流量趋势
    // 景点实时客流量趋势
    @Operation(summary = "景点实时客流量趋势")
    @GetMapping("/spotRealTimeTrafficTrend")
    @ResponseBody
    public AjaxResult spotRealTimeTrafficTrend() {
        return AjaxResult.success(adminChartsService.spotRealTimeTrafficTrend());
    }


    //每日预定于实际到访对比
    // 每日预定于实际到访对比
    @Operation(summary = "每日预定于实际到访对比 data1 到访 data2 售票")
    @GetMapping("/dailyBookingVsActualVisitsComparison")
    @ResponseBody
    public AjaxResult dailyBookingVsActualVisitsComparison() {
        return AjaxResult.success(adminChartsService.dailyBookingVsActualVisitsComparison());
    }


    //每周预定与实际到访对比
    // 每周预定与实际到访对比
    @Operation(summary = "每周预定与实际到访对比")
    @GetMapping("/weeklyBookingVsActualVisitsComparison")
    @ResponseBody
    public AjaxResult weeklyBookingVsActualVisitsComparison() {
        return AjaxResult.success(adminChartsService.weeklyBookingVsActualVisitsComparison());
    }

    //客流分布分析
    // 客流分布分析
    @Operation(summary = "客流分布分析")
    @GetMapping("/passengerFlowDistributionAnalysis")
    @ResponseBody
    public AjaxResult passengerFlowDistributionAnalysis() {
        return AjaxResult.success(adminChartsService.passengerFlowDistributionAnalysis());
    }
}
